#!/usr/bin/env python

import SimpleHTTPServer
import SocketServer
import threading
import os

class PServer(threading.Thread):
	
	def __init__(self):
	
		threading.Thread.__init__(self)
        
		pass

	
	def run(self):
		
		self.server()
		
		
			
	def server(self):
		
		
			
		PORT = 8000

		Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

		self.httpd = SocketServer.TCPServer(("", PORT), Handler)

		print "serving at port", PORT
		
		
		self.httpd.serve_forever()
			
		
	def stopServer(self):
	
		try:
			self.httpd.server_close()
		except:
			print "teste"
			pass                
		
		
		print "servidor fechado"
		pass
		

		
	
	
